/**
 * @File name: board.h
 * @Synopsis:
 * @Author: xing.dai@aliyun.com
 * @Version: 0.0.1
 * @Date: 2018-08-01 11:20
 */

#ifndef __BOARD_H__
#define __BOARD_H__

#include  <cpu.h>
#include  <cpu_core.h>
#include <os.h>
#include <stdio.h>

/* Definition for USART1 resources ******************************************/
#define USART1_CLK                       RCC_APB2Periph_USART1
#define USART1_CLK_INIT                  RCC_APB2PeriphClockCmd
#define USART1_IRQn                      USART1_IRQn
#define USART1_IRQHandler                USART1_IRQHandler

#define USART1_TX_PIN                    GPIO_Pin_9
#define USART1_TX_GPIO_PORT              GPIOA
#define USART1_TX_GPIO_CLK               RCC_AHB1Periph_GPIOA
#define USART1_TX_SOURCE                 GPIO_PinSource9
#define USART1_TX_AF                     GPIO_AF_USART1

#define USART1_RX_PIN                    GPIO_Pin_10
#define USART1_RX_GPIO_PORT              GPIOA
#define USART1_RX_GPIO_CLK               RCC_AHB1Periph_GPIOA
#define USART1_RX_SOURCE                 GPIO_PinSource10
#define USART1_RX_AF                     GPIO_AF_USART1

typedef enum {
    RED = 0,
    GREEN,
    BLUE,
    YELLOW,
    PURPLE,
    CYAN,
    WHITE,
    RGB_OFF,
} LED_TYPE_ENUM;

//void hw_init_early(void);

//void board_init(void);
void bsp_int_disable_all(void);

void rgb_led(int index);

int board_putc(int ch, FILE *f);

#if (CPU_CFG_TS_TMR_EN == DEF_ENABLED)
void  CPU_TS_TmrInit (void);
#endif

#if (CPU_CFG_TS_TMR_EN == DEF_ENABLED)
CPU_TS_TMR  CPU_TS_TmrRd (void);
#endif

#if (CPU_CFG_TS_32_EN == DEF_ENABLED)
CPU_INT64U  CPU_TS32_to_uSec (CPU_TS32  ts_cnts);
#endif

#if (CPU_CFG_TS_64_EN == DEF_ENABLED)
CPU_INT64U  CPU_TS64_to_uSec (CPU_TS64  ts_cnts);
#endif
#endif

